#include <iostream>
#include <string.h>
using namespace std;
//作用:可以让两个自定义类型对象进行对比操作
class Person{
public:
    Person(string name,int age){
        this->m_Age = age;
        this->m_Name = name;

    }

    bool operator==(Person &p){
        if (this->m_Name == p.m_Name && this->m_Age == p.m_Age)
        {
            return true;
        }
        return false;
    }

    bool operator!=(Person &p){
        if (this->m_Name == p.m_Name && this->m_Age == p.m_Age)
        {
            return false;
        }
        return true;
    }

    int m_Age;
    string m_Name;

};

void test01(){
    Person p1("Tom",18);
    Person p2("Jerry",18);
    if(p1 == p2){
        cout << "p1 == p2" << endl; 
    }else{
        cout << "p1 != p2" << endl; 
    }
    if(p1 != p2){
        cout << "p1 != p2" << endl; 
    }else{
        cout << "p1 == p2" << endl; 
    }

}


int main(){
    test01();

    system("pause");
    return 0;
}